<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2021/8/24
  Time: 9:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登陆页面</title>
    <script>
        window.onload = function(){
            document.getElementById("img1").onclick = function(){
                console.log("点击")
                // 更新验证码
                this.src=this.src+'?'+Math.random();
            }
        }
    </script>
    <style>
        div{
            color: red;
        }
    </style>
</head>
<body>
<%--表单--%>
<form action=<%=request.getContextPath()+"/login"%> method="post">
    <table>
        <tr>
            <td>用户名</td>
            <td><input type="text" name="username"></td>
        </tr>
        <tr>
            <td>密码</td>
            <td><input type="password" name="password"></td>
        </tr>
        <tr>
            <td>验证码</td>
            <td><input type="text" name="checkCode"></td>
        </tr>
        <%--    验证码展示--%>
        <tr>
            <td colspan="2"><img id="img1" src=<%=request.getContextPath()+"/checkCode"%>></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" value="登录"></td>
        </tr>
        <tr>
            <td><input type="button" onclick='location.href=("regedit.jsp")' value="注册" /></td>
        </tr>
    </table>
<%--    输出错误信息--%>
    <%=request.getAttribute("login_error")==null?"":request.getAttribute("login_error")%>
    <%=request.getAttribute("cc_error")==null?"":request.getAttribute("cc_error")%>

</form>
</body>
</html>
